package gncom.qr;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.KeyEvent;
import android.widget.TextView;

public class TextViewerPage extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.textviewer_page);	
		
		TextView QR_textView = (TextView)findViewById(R.id.QR_textView);
		
		
		String text = getIntent().getStringExtra("text");
		
		QR_textView.setText(text);
		
		if(text.indexOf("http://")>0){
			QR_textView.setText("");
			String code = text.substring(0,text.indexOf("http://"));
			
			String url = "";
			url = text.substring(text.indexOf("http://"));
			
			QR_textView.append(code+"\n");
			QR_textView.append(Html.fromHtml("<a href=\""+url+"\">" +url +"</a> "));
	        QR_textView.setMovementMethod(LinkMovementMethod.getInstance());
		}
		
	}
	
	
}